Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Actual counter-proposal to TIP #707 |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | tip-707-alt |
Files: | files | file ages | folders |
SHA3-256: |
904cd27d0ebf1e4aff31693d0917e439 |
User & Date: | jan.nijtmans 2024-12-02 07:11:56.672 |
Context
2024-12-02
| ||
09:49 | Actual follow-up (not really a counter-proposal) to TIP #707, with a further simplification. Rebased... Closed-Leaf check-in: 89564bda22 user: jan.nijtmans tags: tip-707-alt | |
07:11 | Actual counter-proposal to TIP #707 check-in: 904cd27d0e user: jan.nijtmans tags: tip-707-alt | |
2024-12-01
| ||
23:01 | Experiment: simplify internal representation notation Closed-Leaf check-in: bf30412994 user: jan.nijtmans tags: intrep-simpl | |
17:42 | Fix compiler-warnings when TCL_COMPILE_DEBUG=1 check-in: b688a485b2 user: jan.nijtmans tags: trunk, main | |
Changes
Changes to generic/tcl.h.
︙ | ︙ | |||
724 725 726 727 728 729 730 731 732 733 734 735 736 737 | void *ptr1; void *ptr2; } twoPtrValue; struct { /* - internal rep as a pointer and a long, */ void *ptr; /* not used internally any more. */ unsigned long value; } ptrAndLongRep; } Tcl_ObjInternalRep; /* * One of the following structures exists for each object in the Tcl system. * An object stores a value as either a string, some internal representation, * or both. */ | > > > > > > > > | 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 | void *ptr1; void *ptr2; } twoPtrValue; struct { /* - internal rep as a pointer and a long, */ void *ptr; /* not used internally any more. */ unsigned long value; } ptrAndLongRep; struct { void *ptr; void *ptr2; }; struct { void *notUsed; Tcl_Size size; }; } Tcl_ObjInternalRep; /* * One of the following structures exists for each object in the Tcl system. * An object stores a value as either a string, some internal representation, * or both. */ |
︙ | ︙ |
Changes to generic/tclVar.c.
︙ | ︙ | |||
231 232 233 234 235 236 237 | static Tcl_FreeInternalRepProc FreeParsedVarName; static Tcl_DupInternalRepProc DupParsedVarName; /* * Types of Tcl_Objs used to cache variable lookups. * * localVarName - INTERNALREP DEFINITION: | | | | | | | | | | | | | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | static Tcl_FreeInternalRepProc FreeParsedVarName; static Tcl_DupInternalRepProc DupParsedVarName; /* * Types of Tcl_Objs used to cache variable lookups. * * localVarName - INTERNALREP DEFINITION: * ptr: pointer to name obj in varFramePtr->localCache * or NULL if it is this same obj * size: index into locals table * * parsedVarName - INTERNALREP DEFINITION: * ptr: pointer to the array name Tcl_Obj, or NULL if it is a * scalar variable * ptr2: pointer to the element name string (owned by this * Tcl_Obj), or NULL if it is a scalar variable */ static const Tcl_ObjType localVarNameType = { "localVarName", FreeLocalVarName, DupLocalVarName, NULL, NULL, TCL_OBJTYPE_V0 }; #define LocalSetInternalRep(objPtr, index, namePtr) \ do { \ Tcl_ObjInternalRep ir; \ Tcl_Obj *ptr = (namePtr); \ if (ptr) {Tcl_IncrRefCount(ptr);} \ ir.ptr = ptr; \ ir.size = index; \ Tcl_StoreInternalRep((objPtr), &localVarNameType, &ir); \ } while (0) #define LocalGetInternalRep(objPtr, index, name) \ do { \ const Tcl_ObjInternalRep *irPtr; \ irPtr = TclFetchInternalRep((objPtr), &localVarNameType); \ (name) = irPtr ? (Tcl_Obj *)irPtr->ptr : NULL; \ (index) = irPtr ? irPtr->size : TCL_INDEX_NONE; \ } while (0) static const Tcl_ObjType parsedVarNameType = { "parsedVarName", FreeParsedVarName, DupParsedVarName, NULL, NULL, TCL_OBJTYPE_V0 }; #define ParsedSetInternalRep(objPtr, arrayPtr, elem) \ do { \ Tcl_ObjInternalRep ir; \ Tcl_Obj *ptr1 = (arrayPtr); \ Tcl_Obj *ptr2 = (elem); \ if (ptr1) {Tcl_IncrRefCount(ptr1);} \ if (ptr2) {Tcl_IncrRefCount(ptr2);} \ ir.ptr = ptr1; \ ir.ptr2 = ptr2; \ Tcl_StoreInternalRep((objPtr), &parsedVarNameType, &ir); \ } while (0) #define ParsedGetInternalRep(objPtr, parsed, array, elem) \ do { \ const Tcl_ObjInternalRep *irPtr; \ irPtr = TclFetchInternalRep((objPtr), &parsedVarNameType); \ (parsed) = (irPtr != NULL); \ (array) = irPtr ? (Tcl_Obj *)irPtr->ptr : NULL; \ (elem) = irPtr ? (Tcl_Obj *)irPtr->ptr2 : NULL; \ } while (0) Var * TclVarHashCreateVar( TclVarHashTable *tablePtr, const char *key, int *newPtr) |
︙ | ︙ | |||
5718 5719 5720 5721 5722 5723 5724 | *---------------------------------------------------------------------- */ /* * localVarName - * * INTERNALREP DEFINITION: | | | | 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 | *---------------------------------------------------------------------- */ /* * localVarName - * * INTERNALREP DEFINITION: * ptr: pointer to name obj in varFramePtr->localCache * or NULL if it is this same obj * ptr2: index into locals table */ static void FreeLocalVarName( Tcl_Obj *objPtr) { Tcl_Size index; |
︙ | ︙ | |||
5757 5758 5759 5760 5761 5762 5763 | LocalSetInternalRep(dupPtr, index, namePtr); } /* * parsedVarName - * * INTERNALREP DEFINITION: | | | | 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 | LocalSetInternalRep(dupPtr, index, namePtr); } /* * parsedVarName - * * INTERNALREP DEFINITION: * ptr = pointer to the array name Tcl_Obj (NULL if scalar) * ptr2 = pointer to the element name string (owned by this * Tcl_Obj), or NULL if it is a scalar variable */ static void FreeParsedVarName( Tcl_Obj *objPtr) { |
︙ | ︙ |